#include"processBar.h"
#include<unistd.h>

typedef void(*callback_t)(int);

void DownLoad(callback_t cb)
{
    int total =1000; //1000MB
    int curr = 0;
    while(curr<=total)
    {
        usleep(5000);
        int rate=(curr*100/total);
        cb(rate);
        curr+=10;
    }
    printf("\n");
}
int main()
{
    printf("donwnload 1: \n");
    DownLoad(processbar);
    InitBar();
    printf("donwnload 2: \n");
    DownLoad(processbar);
    InitBar();
    printf("donwnload 3: \n");
    DownLoad(processbar);
    InitBar();
    printf("donwnload 4: \n");
    DownLoad(processbar);
    InitBar();
    return 0;
}
